<!DOCTYPE html>
<html>
<head>
  <title>MOSQUITO</title>
</head>

<body>
  <!-- SCRIPTS -->

  <!-- waax r12 -->
  <script src="waax/WAAX.js"></script>
  <script src="waax/Fader.js"></script>
  <script src="waax/Sampler.js"></script>

  <!-- entry point -->
  <script type="text/javascript">

    var sampler = WX.Sampler({ pLoop: true, pGain: 0.25 });
    var panner = WX.nPanner();

    sampler.connect(panner);
    panner.connect(WX.DAC.inlet);

    var buffermap = WX.BufferMap({
      'mosquito': 'data/mosquito.mp3'
      }, function () {
        sampler.setBuffer(buffermap.getBufferByName('mosquito'));
        sampler.start(WX.now);
      });

    var phi = 0.0;
    var dist = 3.0;
    function loop() {
      phi += 0.01;
      panner.setPosition(Math.sin(phi) * 6, Math.sin(phi) * 4, Math.cos(phi) * 3);
      requestAnimationFrame(loop);
    }
    loop();

  </script>

</body>
</html>